const redis = require("redis");

// 创建客户端
const redisClient = redis.createClient(6379, "127.0.0.1")

!(async function () {
  
  // 连接
  await redisClient.connect().then(() => {
    console.log("redis connect success!")
  }).catch(console.error)
  // set
  await redisClient.set("myname", "wangnan3")
  // get
  const myname = await redisClient.get("myname")
  console.log("myname: ", myname)
  // 退出
  redisClient.quit()
})()

// const test = (param) => {
//   if(param === 4) {
//     return "yes"
//   }
// }

// console.log("返回yes", test(4));   // 返回yes yes
// console.log("返回undefined", test(2))  // 返回undefined undefined